<div class="fm-content">
  <!-- 最上面标题栏 -->
  <div class="title">
    <i nz-icon [type]="'desktop'"></i>
    &nbsp;&nbsp;我的授权
  </div>
  <!-- 内容 -->
  <div class="work">

    <!-- 查询框 -->
    <div class="top">
    <!-- first-input -->	
	    <input nz-input placeholder="用户" class="fm-input first-input" [(ngModel)]="fs.queryObject['tokenname:like']" />
      <nz-button-group>
        <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
        <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
      </nz-button-group>
      <div class="tool-right">
        <nz-button-group>
          <button nz-button [nzType]="'primary'" (click)="fs.addRow()">新增</button>
          <button nz-button (click)="fs.editRow()">编辑</button>
          <button nz-popconfirm nzTitle="确认删除选择项?" (nzOnConfirm)="fs.delEntitys()" nzPlacement="bottomRight"
            nz-button>删除</button>
        </nz-button-group>
      </div>
    </div>

    <!-- 右则样表单主体 -->
    <div class="work-content">
      <div class="table">
        <nz-table nzSize="middle" nzShowSizeChanger
        [nzPageSizeOptions]='[ 10, 15, 20, 30, 40, 50 ]' 
        [nzFrontPagination]="false" 
        [nzData]="fs.datas"
        [nzLoading]="fs.isLoading || fs.isDeleing"
        [nzTotal]="fs.rowsCount" 
        [(nzPageIndex)]="fs.pageIndex"
        [(nzPageSize)]="fs.pageSize" 
        (nzPageIndexChange)="fs.loadData()"
        (nzPageSizeChange)="fs.loadData(true)">
        <thead>
            <tr>
                <th nzShowCheckbox [(nzChecked)]="fs.allChecked"
                    [nzIndeterminate]="fs.indeterminate"
                    (nzCheckedChange)="fs.checkAll($event)"></th>
				<th nzWidth="10%">用户</th>
				<th nzWidth="10%">服务名称</th>
				<th nzWidth="10%">路径</th>
				<th nzWidth="20%">服务所属名称</th>
				<th nzWidth="20%">开始时间</th>
				<th nzWidth="20%">结束时间</th>
                <th nzWidth="10%">是否授权</th>
            </tr>
        </thead>
        <tbody>
            <tr *ngFor="let data of fs.datas">
                <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="fs.refreshCheckStatus()">
                </td>
            		<td><span (click)="fs.editRow(data)" class="form-edit">{{data.tokenname}}</span></td>
            		<td>{{data.servicename}}</td>
            		<td>{{data.url}}</td>
            		<td>{{data.serviceowername}}</td>
				<td>{{data.starttime | date:'yyyy-MM-dd HH:mm:ss' }}</td>
				<td>{{data.datetime | date:'yyyy-MM-dd HH:mm:ss' }}</td>
            		<td>{{data.isauthorization | boolReform}}</td>
            </tr>
        </tbody>
    </nz-table>
      </div>
    </div>

    <nz-modal nzWidth='830' nzTitle="编辑" [nzMaskClosable]='false' 
        [nzFooter]="null"
        [(nzVisible)]="fs.isEditVisible"
        (nzOnCancel)="fs.closeEdit()" >
        <form nz-form [nzLayout]="'inline'">
			<div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="12">
                    <nz-form-item>
                        <nz-form-label class="form-label">用户</nz-form-label>
                        <nz-form-control class="form-control" nzHasFeedback>
                            <input nz-input [(ngModel)]="fs.er.tokenname"
                                	name="tokenname" required #tokenname="ngModel" [disabled]="true"/>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item>
                        <nz-form-label  class="form-label">服务名称</nz-form-label>
                        <nz-form-control class="form-control" nzHasFeedback>
                            <input nz-input [(ngModel)]="fs.er.servicename"
                                	name="servicename" required #servicename="ngModel" [disabled]="true" />
                        </nz-form-control>
                    </nz-form-item>
                </div>
            </div>
			<div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="24">
                    <nz-form-item>
                        <nz-form-label class="form-label">路径</nz-form-label>
                        <nz-form-control class="form-control3" nzHasFeedback>
                            <input nz-input [(ngModel)]="fs.er.url"
                                	name="url" required #url="ngModel" [disabled]="true" />
                        </nz-form-control>
                    </nz-form-item>
                </div>
            </div>
			<div nz-row [nzGutter]="24">
                	<div nz-col [nzSpan]="12">
                    	<nz-form-item>
                        	<nz-form-label nzRequired class="form-label">开始时间</nz-form-label>
                        	<nz-form-control class="form-control" nzHasFeedback>
                        		<nz-date-picker nzShowTime
                            		[(ngModel)]="fs.er.starttime"
                                	name="starttime" required #starttime="ngModel"></nz-date-picker>
                        	</nz-form-control>
                    	</nz-form-item>
                	</div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item>
                        <nz-form-label nzRequired class="form-label">结束时间</nz-form-label>
                        <nz-form-control class="form-control" nzHasFeedback>
                            <nz-date-picker nzShowTime
                                [(ngModel)]="fs.er.datetime"
                                name="datetime" required #datetime="ngModel"></nz-date-picker>
                        </nz-form-control>
                    </nz-form-item>
                </div>
            </div>
            <div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="12">
                    <nz-form-item>
                        <nz-form-label  class="form-label">服务所属名称</nz-form-label>
                        <nz-form-control class="form-control" nzHasFeedback>
                            <input nz-input [(ngModel)]="fs.er.serviceowername"
                                	name="serviceowername" required #serviceowername="ngModel" [disabled]="true" />
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item>
                        <nz-form-label nzRequired class="form-label">是否授权</nz-form-label>
                        <nz-form-control class="form-control" nzHasFeedback>
                            <nz-switch nzCheckedChildren="是" nzUnCheckedChildren="否" [(ngModel)]="fs.er.isauthorization" name="valid">
                            </nz-switch>
                        </nz-form-control>
                    </nz-form-item>
                </div>
            </div>  
           	<div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="24" class="form-button-align">
                    <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
                    <button nz-button nzType="primary" 
                    		[disabled]='false'
                        	(click)="fs.save()" [nzLoading]="fs.isSaveing">保存</button>
                </div>
            </div>
        </form>
    </nz-modal>
  </div>
</div>
